package com.xjtu.common.timer;


import com.xjtu.common.constant.Socket;
import com.xjtu.config.SocketManager;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

@Component
@EnableScheduling
public class PingTask {

    /**
     * 每30s给全部在线设备发送一次心跳
     */
    @Scheduled(fixedRate = Socket.HEARTBEAT_INTERVAL)
    private void sendPing() {
        SocketManager.sendPing();
    }
}
